var Event = function(data) {
	var _this = this;

	this.testBut = $("#botBut1").bind('click', function(){
		_this.data.reload();
		console.log(_this.data.graph.channels['channel-1'].plots);
	});
	this.testBut = $("#botBut2").bind('click', function(){_this.tickerOn()});
	this.testBut = $("#botBut3").bind('click', function(){_this.tickerOff()});
	this.testBut = $("#botBut4").bind('click', function(){
		var ch = _this.data.graph.channels.acc_x;
		for (var j = 0; j<ch.history.length; j++){
			var h = ch.history[j];
			// console.log("cursor: "+ch.cursor+", j: "+j+", howOld: "+ch.howOld(j), h );
		}
	});
	this.data = data;
	this.ticker;
	this.win = $(window);
	this.win.bind('click', function(){ 
	//	alert(graph.place.attr('id')); 
	});
	this.win.bind('resize', function(){
		//var w = Math.floor(_this.win.width()*0.3);
		//console.log(w);
		//console.log(graph.place);
		$("#placeholder").css({'width':'100%'});
		graph.paintAll();
	});
	this.tickerOn = function(e){
		
		if (undefined === _this.tickerOn.count) _this.tickerOn.count = 0;
		else _this.tickerOn.count++;
		//console.log(_this.tickerOn.count);
		_this.ticker = setInterval(function(){
			//$("#monitor").html(_this.data.file.size);
			//console.log (_this.tickerOn.count);
			_this.data.reload();
			//$("#monitor").empty();
			
		}
		,100);
	
	}
	this.tickerOff = function(){
		clearInterval(_this.ticker);
	}
	this.file = $('#sensFile');
	this.file.bind('change', function(e){_this.fileSelect(e)});
	this.fileSelect = function(evt){
		if (!evt.target.files.length) return;
		//console.log(evt.target.files);
		var files = evt.target.files; // FileList object
		controls.clearLeft();
		//color.map=[];
		color.i=0;
		this.data.graph.clear();
		this.data.graph.paintAll();
		this.data.file=files[0];
		controls.clearLeft();
		this.tickerOn();
		//this.data.reload();
		//console.log(this.data.graph.history[0]);
		
	};
	
	
};
